﻿using System;
using System.Linq;
using System.Text;
using XmlDatabase.Core.Properties;

namespace XmlDatabase.Core
{
    public class XDatabaseException : Exception
    {
        private XDatabaseException() { }
        private string _message;
        
        public override string Message { get => _message;}

        public XDatabaseException(String key, params String[] place)
        {
            StringBuilder stringBuilder = new StringBuilder(Resources.ResourceManager.GetString(key));
            if (place.Length > 0)
            {
                int num = 0;
                place.ToList<String>().ForEach((newValue) => stringBuilder.Replace("{" + num.ToString() + "}", newValue));
            }
            this._message = stringBuilder.ToString();
        }
    }
}
